﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Artemis;

namespace JAWWS
{  


    class Material
    {

        float[] ambient;
        float[] diffuse;
        float[] specular;
        float shininess;

        public Material()
        {
            ambient = new float[4] {0.0f,0.0f,0.0f,1.0f};
            diffuse = new float[4] {0.0f,0.0f,0.0f,1.0f};
            specular = new float[4] { 0.0f, 0.0f, 0.0f, 1.0f };
            shininess = 32.0f;
        }

        public void setGlass(){

            ambient = new float[4] {1.0f,1.0f,1.0f,0.3f};
            diffuse = new float[4] {1.0f,1.0f,1.0f,0.2f};
            specular = new float[4] {1.0f, 1.0f, 1.0f, 0.2f };
            shininess = 100.0f;
        }

        public void setRedPlastic()
        {

            ambient = new float[4] { 0.3f, 0.0f, 0.0f, 1.0f };
            diffuse = new float[4] { 0.6f, 0.0f, 0.0f, 1.0f };
            specular = new float[4] { 0.8f, 0.6f, 0.6f, 1.0f };
            shininess = 32.0f;
        }

        public void set_material(uint face, String materialType)
        {
            if( materialType.Equals("glass")){
                setGlass();
                GL.glMaterialfv(face,GLenum.GL_AMBIENT,ambient);
                GL.glMaterialfv(face,GLenum.GL_DIFFUSE,diffuse);
                GL.glMaterialfv(face,GLenum.GL_SPECULAR,specular);
                GL.glMaterialf(face,GLenum.GL_SHININESS,shininess);
            }else if( materialType.Equals("RedPlastic")){
                setRedPlastic();
                GL.glMaterialfv(face,GLenum.GL_AMBIENT,ambient);
                GL.glMaterialfv(face,GLenum.GL_DIFFUSE,diffuse);
                GL.glMaterialfv(face,GLenum.GL_SPECULAR,specular);
                GL.glMaterialf(face,GLenum.GL_SHININESS,shininess);
            }
        }

    }
}
